/* $RCSFile: DownloadExplorer.aspx.cs $
 * Apache license v2 2011 by Christian Surieux
 * $Source: ?/AddonNice.ECommerce/PageModules/Download/DownloadExplorer.aspx.cs $
 * $log$
 * Revision 21 2010/08/09 11:08:11  christian.surieux
 *   Added Log comment to all .ascx .aspx .master files
 * Revision 8 2010/08/09 10:07:05  christian.surieux
 *   Added Log comment to all cs files
 */

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Globalization;

using AddonNice.UI;
using AddonNice.Settings;
using AddonNice.UI.WebControls;
using AddonNice.Security;
using AddonNice.Configuration;
using AddonNice.Diagnostics;
using AddonNice.Helpers;
using AddonNice.ECommerce;

using Telerik.Web.UI;

using Trace2    =   System.Diagnostics.Trace;
using Path2     =   AddonNice.Settings.Path;

namespace AddonNice.PageModules.Download
{
    public partial class DownloadExplorer : StdAuxPage // could be derived from Page but we want to get the default site theme
    {
        // We do not want the default site masterPage
        public override bool SupportMasterPage
        {
            get
            {
                return false;
            }
        }
                
        string DefaultDownloadUrl
        {
            get
            {
                string url  =   moduleSettingsDic[EComStStr.DownloadUrl].ToString();
	            if (PageTraceSwitch.Sw.TraceVerbose || ModuleTraceSwitch.Sw.TraceVerbose)
                    Trace2.WriteLine( string.Format(CultureInfo.InvariantCulture,"[V]DownloadExplorer DefaultDownloadUrl url: {0}.",url),PageTraceSwitch.Sw.Info);
                return url;
            }
        }

 		override protected void OnInit(EventArgs e)
		{
	        if (PageTraceSwitch.Sw.TraceVerbose)
                Trace2.WriteLine("[V]DownloadExplorer OnInit BEG.",PageTraceSwitch.Sw.Info);
			InitializeComponent();	
			base.OnInit(e);
	        if (PageTraceSwitch.Sw.TraceVerbose)
                Trace2.WriteLine("[V]DownloadExplorer PreInit END.",PageTraceSwitch.Sw.Info);
		}

		private void InitializeComponent() 
		{    
			//Load						                +=	new System.EventHandler(Page_Load);
            //Uri nuri                                    =   new Uri(DefaultDownloadUrl,);
            string wpth                                 =   DefaultDownloadUrl;//nuri.AbsolutePath;
            FileExplorer1.InitialPath                   =   Page.ResolveUrl(wpth); //"~/Downloads");
	        if (PageTraceSwitch.Sw.TraceVerbose || ModuleTraceSwitch.Sw.TraceVerbose)
                Trace2.WriteLine( string.Format(CultureInfo.InvariantCulture,"[V]DownloadExplorer InitializeComponent FileExplorer1.InitialPath: {0}.",FileExplorer1.InitialPath ),PageTraceSwitch.Sw.Info);
            string[] expaths                            =   new string[]{wpth}; // "~/Downloads"
            FileExplorer1.Configuration.ViewPaths       =   expaths;
            FileExplorer1.Configuration.UploadPaths     =   expaths;
            FileExplorer1.Configuration.DeletePaths     =   expaths;

            //FileExplorer1.Configuration.SearchPatterns  =  new string[]{"*.*"};
 		}
   }
}
